package game_elements_layer.resourses_stuff;

/**
 * Created with IntelliJ IDEA.
 * User: Slava
 * Date: 06.10.14
 * Time: 23:25
 * To change this template use File | Settings | File Templates.
 */
public class ResourceToMoneyConverter {
    private int alcoholExchangeRate;
    private int gunsExchangeRate;
    private int drugsExchangeRate;

    public ResourceToMoneyConverter(int alcoholExchangeRate, int gunsExchangeRate, int drugsExchangeRate) {

        this.alcoholExchangeRate = alcoholExchangeRate;
        this.gunsExchangeRate = gunsExchangeRate;
        this.drugsExchangeRate = drugsExchangeRate;
    }

    public Money convert(Resources resources){
        if (Alcohol.class.isInstance(resources))
            return new Money(resources.getAmount() * this.alcoholExchangeRate);
        if (Guns.class.isInstance(resources))
            return new Money(resources.getAmount() *this.gunsExchangeRate);
        if (Drugs.class.isInstance(resources))
            return new Money(resources.getAmount() *this.drugsExchangeRate);
        return null;
    }
};
